package com.ruoyi.system.service.impl;

import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.dto.SysOrderDto;
import com.ruoyi.common.core.domain.entity.system.SysBoat;
import com.ruoyi.common.core.domain.entity.system.SysJishiOrder;
import com.ruoyi.common.core.domain.entity.system.SysScenic;
import com.ruoyi.common.core.domain.entity.system.SysWharf;
import com.ruoyi.common.utils.CacheUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.system.mapper.SysBoatMapper;
import com.ruoyi.system.mapper.SysJishiOrderMapper;
import com.ruoyi.system.mapper.SysScenicMapper;
import com.ruoyi.system.mapper.SysWharfMapper;
import com.ruoyi.system.service.ISysJishiOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * 计时计费订单Service业务层处理
 *
 * @author zjw
 * @date 2023-08-18
 */
@Service
public class SysJishiOrderServiceImpl implements ISysJishiOrderService {
    @Resource
    private SysJishiOrderMapper sysJishiOrderMapper;
    @Resource
    private SysScenicMapper sysScenicMapper;
    @Resource
    private SysWharfMapper sysWharfMapper;
    @Resource
    private SysBoatMapper sysBoatMapper;

    /**
     * 查询计时计费订单
     *
     * @param orderId 计时计费订单主键
     * @return 计时计费订单
     */
    @Override
    public SysJishiOrder selectSysJishiOrderByOrderId(String orderId) {
        return sysJishiOrderMapper.selectSysJishiOrderByOrderId(orderId);
    }

    /**
     * 查询计时计费订单列表
     *
     * @param sysJishiOrder 计时计费订单
     * @return 计时计费订单
     */
    @Override
    public List<SysJishiOrder> selectSysJishiOrderList(SysJishiOrder sysJishiOrder) {
        return sysJishiOrderMapper.selectSysJishiOrderList(sysJishiOrder);
    }

    /**
     * 新增计时计费订单
     *
     * @param sysJishiOrder 计时计费订单
     * @return 结果
     */
    @Override
    public int insertSysJishiOrder(SysJishiOrder sysJishiOrder) {
        sysJishiOrder.setCreateTime(DateUtils.getNowDate());
        return sysJishiOrderMapper.insertSysJishiOrder(sysJishiOrder);
    }

    /**
     * 修改计时计费订单
     *
     * @param sysJishiOrder 计时计费订单
     * @return 结果
     */
    @Override
    public int updateSysJishiOrder(SysJishiOrder sysJishiOrder) {
        return sysJishiOrderMapper.updateSysJishiOrder(sysJishiOrder);
    }

    /**
     * 批量删除计时计费订单
     *
     * @param orderIds 需要删除的计时计费订单主键
     * @return 结果
     */
    @Override
    public int deleteSysJishiOrderByOrderIds(Long[] orderIds) {
        return sysJishiOrderMapper.deleteSysJishiOrderByOrderIds(orderIds);
    }

    /**
     * 删除计时计费订单信息
     *
     * @param orderId 计时计费订单主键
     * @return 结果
     */
    @Override
    public int deleteSysJishiOrderByOrderId(Long orderId) {
        return sysJishiOrderMapper.deleteSysJishiOrderByOrderId(orderId);
    }

    @Override
    public SysJishiOrder queryUnpaidOrder(Long userId) {
        return sysJishiOrderMapper.queryUnpaidOrder(userId);
    }

    @Override
    public SysJishiOrder queryToUseOrder(Long userId) {
        return  sysJishiOrderMapper.queryToUseOrder(userId);
    }

    @Override
    public SysJishiOrder queryUsingOrder(Long userId) {
        return sysJishiOrderMapper.queryUsingOrder(userId);
    }

    @Override
    public List<SysJishiOrder> queryFulfilledOrder(Long userId) {
        return sysJishiOrderMapper.queryFulfilledOrder(userId);
    }

    @Override
    public List<SysJishiOrder> queryAllOrder(Long userId) {
        return sysJishiOrderMapper.queryAllOrder(userId);
    }

    @Override
    public SysJishiOrder queryInProgressOrder(Long userId) {
        return sysJishiOrderMapper.queryInProgressOrder(userId);
    }
}
